package com.demo;

import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;

import com.demo.business.LoginButtonBusiness;
import com.demo.business.PasswordInputBusiness;
import com.demo.business.ToolBarBusiness;
import com.keguoyu.easymvp.annotation.Provider;
import com.keguoyu.easymvp.business.Business;

import io.reactivex.subjects.BehaviorSubject;

public class MainActivity extends AppCompatActivity {

  @Provider("name")
  BehaviorSubject<String> nameSubject = BehaviorSubject.create();

  @Provider("password")
  BehaviorSubject<String> passwordSubject = BehaviorSubject.create();

  private Business business;

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    business.add(new LoginButtonBusiness());
    business.add(new PasswordInputBusiness());
    business.add(new ToolBarBusiness());
    business.create(this);
    business.bind(this);
  }

  @Override
  protected void onDestroy() {
    super.onDestroy();
    business.unBind();
    business.destroy();
  }
}
